import request from '@/utils/request'
//导入@/stores/token.js
import { useTokenStore } from '../stores/token'


// 文章分类列表接口函数
export const articleListService = () => {
    // 拦截器中进行token的添加
    // const tokenStore = useTokenStore()
    // return request.get('/category/list', { headers: { 'Authorization': tokenStore.token } })
    return request.get('/category/list')
}

//添加文章分类
export const articleCategoryAddService = (categoryModel) => {
    return request.post('/category', categoryModel)
}

// 修改文章分类
export const articleCategoryUpdateService = (categoryModel) => {
    return request.put('/category/updateCategory', categoryModel)
}

// 删除文章分类
export const articleCategoryDeleteService = (id) => {
    return request.delete('/category/deleteCategory', { params: { id } })
}

//文章列表查询
export const articleAllListService = (params) => {
    return request.get('/article/list', { params: params })
}


//添加文章
export const articleAddService = (articleModel) => {
    return request.post('/article/addArticle', articleModel)
}

//修改文章
export const articleUpdateService = (articleModel) => {
    return request.put('/article/uploadArticle', articleModel)
}

//删除文章
export const articleDeleteService = (id) => {
    return request.delete('/article/deleteArticle', { params: { id } })
}